﻿Imports System.Globalization
Imports ADOEntityAMLO101
Partial Class KYC_frmTestDate
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim d1 As Date = "11/7/2554"
        Dim d2 As Date = "11/7/2011"

        Dim s1 As String = "11/7/2554"
        Dim s2 As String = "11/7/2011"


        Dim d3 As Date
        Dim d4 As Date

        Dim s3 As String
        Dim s4 As String

        d3 = Date.Parse(s1, New CultureInfo("en-GB")) ' บังคับ ค.ศ.
        d4 = Date.Parse(s2, New CultureInfo("en-GB")) ' บังคับ ค.ศ.
        Label1.Text = d3.ToString
        Label2.Text = d4.ToString

        d3 = Date.Parse(s1, New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        d4 = Date.Parse(s2, New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        Label3.Text = d3.ToString
        Label4.Text = d4.ToString

        Label13.Text = s1.ToString
        Label14.Text = s2.ToString


        s3 = d1.ToString(New CultureInfo("en-GB")) ' บังคับ ค.ศ.
        s4 = d2.ToString(New CultureInfo("en-GB")) ' บังคับ ค.ศ.

        Label5.Text = s3
        Label6.Text = s4

        s3 = d1.ToString(New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        s4 = d2.ToString(New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        Label7.Text = s3
        Label8.Text = s4

        Label15.Text = d1.ToString
        Label16.Text = d2.ToString


        s3 = Date.Now.ToString(New CultureInfo("en-GB")) ' บังคับ ค.ศ.
        s4 = Date.Now.ToString(New CultureInfo("en-GB")) ' บังคับ ค.ศ.

        Label9.Text = s3
        Label10.Text = s4

        s3 = Date.Now.ToString(New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        s4 = Date.Now.ToString(New CultureInfo("th-TH")) ' บังคับ พ.ศ.
        Label11.Text = s3
        Label12.Text = s4

        Label17.Text = Date.Now.ToString
        Label18.Text = Date.Now.ToString

        Date.Now.GetType()

        Label19.Text = System.Globalization.CultureInfo.CurrentCulture.DisplayName _
          & " </br> " & System.Globalization.CultureInfo.CurrentCulture.EnglishName _
         & " </br> " & System.Globalization.CultureInfo.CurrentCulture.Name

        Try
            Dim myDateString1 As String = "12122554"
            Dim myDateString2 As String = "25541212"
            ' Dim myDTFI As DateTimeFormatInfo = New DateTimeFormatInfo
            ' myDTFI.ShortDatePattern = "ddMMyyyy"
            Label20.Text = DateTime.ParseExact(myDateString1, "ddMMyyyy", New CultureInfo("th-TH"))
            Label21.Text = DateTime.ParseExact(myDateString2, "yyyyMMdd", New CultureInfo("th-TH"))
            Label22.Text = DateTime.ParseExact(myDateString1, "ddMMyyyy", New CultureInfo("en-GB"))
            Label23.Text = DateTime.ParseExact(myDateString2, "yyyyMMdd", New CultureInfo("en-GB"))
            ' DateTime.ParseExact("09052002", "ddMMyyyy", Nothing)
            '            string myDateString = "15122004";
            'DateTimeFormatInfo myDTFI = new DateTimeFormatInfo();
            'myDTFI.ShortDatePattern = "ddMMyyyy";
            'DateTime dt = DateTime.Parse(myDateString, myDTFI);

            Dim myDateString3 As String = "12122011"
            Dim myDateString4 As String = "20111212"
            ' Dim myDTFI As DateTimeFormatInfo = New DateTimeFormatInfo
            ' myDTFI.ShortDatePattern = "ddMMyyyy"
            Label24.Text = DateTime.ParseExact(myDateString3, "ddMMyyyy", New CultureInfo("th-TH"))
            Label25.Text = DateTime.ParseExact(myDateString4, "yyyyMMdd", New CultureInfo("th-TH"))
            Label26.Text = DateTime.ParseExact(myDateString3, "ddMMyyyy", New CultureInfo("en-GB"))
            Label27.Text = DateTime.ParseExact(myDateString4, "yyyyMMdd", New CultureInfo("en-GB"))

            'd3 = "12122554"
            'd4 = "25541212"

            'Dim str1 As String = Format("12122554", "dd/MM/YYYY")
            'Dim str2 As String = Format("25541212", "dd/MM/YYYY")
            'Label20.Text = str1
            'Label21.Text = str2
        Catch ex As Exception

        End Try

        Try
            Dim AMLO101Entity As New AMLO101Entities
            Dim qAmlo = (From tblAmlo1 In AMLO101Entity.AMLO101 Where tblAmlo1.RPTSEQ = 1411 Select tblAmlo1.CREATEDATE).ToList

            Label28.Text = CType(qAmlo(0), Date).ToString(New CultureInfo("th-TH"))

            Label29.Text = CType(qAmlo(0), Date).ToString(New CultureInfo("en-GB"))



            Label30.Text = qAmlo(0)
            Label31.Text = Date.Parse(qAmlo(0).ToString, New CultureInfo("th-TH")).ToString
            Label32.Text = Date.Parse(qAmlo(0).ToString, New CultureInfo("en-GB")).ToString
        Catch ex As Exception

        End Try

    End Sub

End Class
